// 管理这个项目的所有接口
import axios from "./request"

// 请求首页数据
export const GetHomeData = () => axios.get("/index/index");

// export const GetHomeData = function () {
//     return axios.get("/index/index");
// }

// 请求历史记录和热么搜索 (get请求无参数的写法)
export const GetHishotData = () => axios.get("/search/index");

// 请求搜索提示列表 (get请求携带参数的写法)
// export const GetSearchTipsData = (val) => axios.get("/search/helper", {
//     params: {
//         keyword: val
//     }
// });

export const GetSearchTipsData = (params) => axios.get("/search/helper", { params });

// 请求搜索产品列表
export const GetGoodsListData = (params) => axios.get("/goods/list", { params });

// 请求清除历史记录
export const ClearHisroty = () => axios.post("/search/clearhistory");


// 发起登录请求
export const ToLogin = (params) => axios.post("/auth/loginByWeb", params);

//请求产品明细
export const GetGoodsDetail = (params) => axios.get("/goods/detail", { params })

//请求相关产品
export const GetGoodsRelated = (params) => axios.get("/goods/related", { params })

// 请求购物车数量
export const GetCartNum = () => axios.get("/cart/index");

// 请求加入购物车
export const ToAddCart = (params) => axios.post("/cart/add", params);

// 请求购物车数据 
export const GetCartData = () => axios.get("/cart/index");

//  请求购物车选中状态 
export const chanGoodsChecked = (params) => axios.post("/cart/checked", params);

//  请求购物车步进器 
export const stepNum = (params) => axios.post("/cart/update", params);

//  请求删除商品 
export const DelGoods = (params) => axios.post("/cart/delete", params);